package com.appwoo.txtws.activity;

import android.app.Dialog;
import android.content.Context;
import android.content.res.Resources;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.Editable;
import android.text.Html;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.LinearLayout.LayoutParams;
import android.widget.RadioButton;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.appwoo.android.exception.NotFoundNetWorkException;
import com.appwoo.android.exception.TimeOutException;
import com.appwoo.txtws.adapter.ListViewCreator;
import com.appwoo.txtws.adapter.Page;
import com.appwoo.txtws.adapter.SimpleListAdapter;
import com.appwoo.txtws.app.App;
import com.appwoo.txtws.app.AppActivity;
import com.appwoo.txtws.bean.StateBean;
import com.appwoo.txtws.bean.WebTypeBean;
import com.appwoo.txtws.component.Arith;
import com.appwoo.txtws.component.Logger;
import com.appwoo.txtws.component.RqSP;
import com.appwoo.txtws.service.SoftLimitService;
import com.appwoo.txtws.service.WebLimitService;
import com.appwoo.txtws.wheel.widget.PageListView;
import com.appwoo.txtws.wheel.widget.PageListView.OnRefreshListener;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
import org.xmlpull.v1.XmlPullParserException;

public class PCWebLimitManager extends AppActivity
{
  protected static final int GUIUPDATEIDENTIFIER = 257;
  private static final String TAG = "PCWebLimitManager";
  private String addURL = "";
  private EditText add_url;
  private TextView add_web_limit;
  private String bid;
  private boolean blDataTask;
  private Button button;
  private TextView del_no;
  private TextView del_yes;
  private TextView delete;
  private List<WebTypeBean> events;
  private int flag = 0;
  private boolean isFoot = false;
  private boolean isKey = false;
  private boolean isKeyClick;
  private boolean isLimit = true;
  private boolean isLimitClick;
  private boolean isStyle = false;
  private boolean isStyleClick;
  private boolean ishandle;
  private List<WebTypeBean> newlist;
  private RelativeLayout no_info;
  private Page<WebTypeBean> page = new Page();
  private RelativeLayout rl;
  private List<WebTypeBean> style_events;
  private Page<WebTypeBean> style_page = new Page();
  private TextView text_alert;
  private String userid;
  private String userpwd;
  private RadioButton webKeyword;
  private RadioButton webLimit;
  private RadioButton webStyle;
  private PageListView web_keyword;
  private PageListView web_limit;
  private PageListView web_style;
  private SimpleListAdapter<WebTypeBean> weblimit;
  private SimpleListAdapter<WebTypeBean> webstyle;

  private void SetWebEvent(int paramInt)
  {
    for (int i = 0; ; i++)
    {
      if (i >= this.page.getEntries().size())
      {
        this.weblimit.notifyDataSetChanged();
        return;
      }
      ((WebTypeBean)this.page.getEntries().get(i)).setFlag_id(paramInt);
    }
  }

  private void addAllWebSite()
  {
    System.out.println("PCWebLimitManager" + this.page.getEntries().size());
    for (int i = 0; ; i++)
    {
      if (i >= this.page.getEntries().size())
      {
        this.weblimit.notifyDataSetChanged();
        return;
      }
      if (!this.newlist.contains(this.page.getEntries().get(i)))
        this.newlist.add((WebTypeBean)this.page.getEntries().get(i));
    }
  }

  private boolean checkURL(String paramString)
  {
    boolean bool = true;
    if (paramString.equals(""))
    {
      bool = false;
      alertMessage(getString(2131427587));
    }
    do
    {
      return bool;
      if (!Arith.isURL(paramString))
      {
        alertMessage(getString(2131427590));
        return false;
      }
    }
    while (!paramString.contains(getString(2131427508)));
    alertMessage(getString(2131427598));
    return false;
  }

  private void initActionBar()
  {
    setBarTitle(getResources().getString(2131428127));
    setBarBackOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        PCWebLimitManager.this.finish();
      }
    });
    setBarHomeText(getResources().getString(2131427535));
    showBarHomeBtn(Boolean.valueOf(true));
    this.button = ((Button)findViewById(2131492864).findViewById(2131493279));
    this.button.setBackgroundDrawable(getResources().getDrawable(2130838112));
    LinearLayout.LayoutParams localLayoutParams = (LinearLayout.LayoutParams)this.button.getLayoutParams();
    localLayoutParams.height = 50;
    localLayoutParams.width = 85;
    this.button.setLayoutParams(localLayoutParams);
    this.button.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        if (PCWebLimitManager.this.flag == 0)
        {
          PCWebLimitManager.this.setBarHomeText(PCWebLimitManager.this.getResources().getString(2131428135));
          PCWebLimitManager.this.flag = 1;
          PCWebLimitManager.this.delete.setVisibility(0);
          PCWebLimitManager.this.delete.setText(PCWebLimitManager.this.getString(2131427535));
          PCWebLimitManager.this.rl.setBackgroundColor(PCWebLimitManager.this.getResources().getColor(2131230730));
          PCWebLimitManager.this.add_web_limit.setVisibility(8);
          PCWebLimitManager.this.weblimit.notifyDataSetChanged();
          PCWebLimitManager.this.newlist.clear();
        }
        do
        {
          return;
          if (PCWebLimitManager.this.flag == 1)
          {
            PCWebLimitManager.this.setBarHomeText(PCWebLimitManager.this.getResources().getString(2131427514));
            PCWebLimitManager.this.addAllWebSite();
            PCWebLimitManager.this.SetWebEvent(1);
            PCWebLimitManager.this.delete.setText("删除 （" + PCWebLimitManager.this.newlist.size() + "）项");
            PCWebLimitManager.this.weblimit.notifyDataSetChanged();
            PCWebLimitManager.this.flag = 2;
            return;
          }
          if (PCWebLimitManager.this.flag == 2)
          {
            PCWebLimitManager.this.flag = 3;
            PCWebLimitManager.this.removeAllWebSite();
            PCWebLimitManager.this.SetWebEvent(0);
            PCWebLimitManager.this.delete.setText("删除 （" + PCWebLimitManager.this.newlist.size() + "）项");
            PCWebLimitManager.this.weblimit.notifyDataSetChanged();
            return;
          }
        }
        while (PCWebLimitManager.this.flag != 3);
        PCWebLimitManager.this.delete.setVisibility(8);
        PCWebLimitManager.this.flag = 0;
        PCWebLimitManager.this.removeAllWebSite();
        PCWebLimitManager.this.SetWebEvent(0);
        PCWebLimitManager.this.rl.setBackgroundColor(PCWebLimitManager.this.getResources().getColor(2131230728));
        PCWebLimitManager.this.add_web_limit.setVisibility(0);
        PCWebLimitManager.this.setBarHomeText(PCWebLimitManager.this.getResources().getString(2131427535));
        PCWebLimitManager.this.removeAllWebSite();
        PCWebLimitManager.this.weblimit.notifyDataSetChanged();
      }
    });
  }

  private void initAdapter()
  {
    if (this.isLimit)
    {
      this.weblimit = new SimpleListAdapter(this.page.getEntries(), new ListViewCreator()
      {
        private int flag_id;

        public View createView(final WebTypeBean paramAnonymousWebTypeBean, View paramAnonymousView, int paramAnonymousInt)
        {
          if (paramAnonymousView == null)
            paramAnonymousView = App.getLayoutInflater().inflate(2130903230, null);
          TextView localTextView1 = (TextView)paramAnonymousView.findViewById(2131493332);
          TextView localTextView2 = (TextView)paramAnonymousView.findViewById(2131493640);
          TextView localTextView3 = (TextView)paramAnonymousView.findViewById(2131493331);
          final CheckBox localCheckBox = (CheckBox)paramAnonymousView.findViewById(2131493011);
          if (PCWebLimitManager.this.flag == 0)
          {
            localCheckBox.setVisibility(8);
            this.flag_id = paramAnonymousWebTypeBean.getFlag_id();
            if (this.flag_id != 1)
              break label151;
            localCheckBox.setChecked(true);
          }
          while (true)
          {
            localTextView1.setText(paramAnonymousWebTypeBean.getTypeName());
            localTextView2.setText(paramAnonymousWebTypeBean.getURL());
            localTextView3.setText(paramAnonymousWebTypeBean.getType());
            localCheckBox.setOnClickListener(new View.OnClickListener()
            {
              public void onClick(View paramAnonymous2View)
              {
                if (localCheckBox.isChecked())
                {
                  paramAnonymousWebTypeBean.setFlag_id(1);
                  PCWebLimitManager.this.newlist.add(paramAnonymousWebTypeBean);
                  PCWebLimitManager.this.delete.setText("删除 （" + PCWebLimitManager.this.newlist.size() + "）项");
                  return;
                }
                paramAnonymousWebTypeBean.setFlag_id(0);
                if (PCWebLimitManager.this.newlist.contains(paramAnonymousWebTypeBean))
                  PCWebLimitManager.this.newlist.remove(paramAnonymousWebTypeBean);
                PCWebLimitManager.this.delete.setText("删除 （" + PCWebLimitManager.this.newlist.size() + "）项");
              }
            });
            return paramAnonymousView;
            localCheckBox.setVisibility(0);
            break;
            label151: localCheckBox.setChecked(false);
          }
        }
      });
      this.web_limit.setAdapter(this.weblimit);
      this.web_limit.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener()
      {
        public boolean onItemLongClick(AdapterView<?> paramAnonymousAdapterView, View paramAnonymousView, int paramAnonymousInt, long paramAnonymousLong)
        {
          if (PCWebLimitManager.this.flag == 0)
          {
            if (!PCWebLimitManager.this.newlist.contains(PCWebLimitManager.this.page.getEntries().get(paramAnonymousInt)))
              PCWebLimitManager.this.newlist.add((WebTypeBean)PCWebLimitManager.this.page.getEntries().get(paramAnonymousInt));
            String str = "将删除当前所选的 " + PCWebLimitManager.this.newlist.size() + " 项记录";
            PCWebLimitManager.this.DeleteRecordDialog(PCWebLimitManager.this, str);
          }
          return false;
        }
      });
      addOperation(new DataTask().execute(new String[] { "weblimit" }));
    }
    do
    {
      return;
      if (this.isStyle)
      {
        this.webstyle = new SimpleListAdapter(this.style_page.getEntries(), new ListViewCreator()
        {
          private CheckBox style_cb;
          private TextView style_name;
          private TextView style_type;

          public View createView(WebTypeBean paramAnonymousWebTypeBean, View paramAnonymousView, int paramAnonymousInt)
          {
            if (paramAnonymousView == null)
              paramAnonymousView = App.getLayoutInflater().inflate(2130903232, null);
            this.style_name = ((TextView)paramAnonymousView.findViewById(2131493332));
            this.style_type = ((TextView)paramAnonymousView.findViewById(2131493331));
            this.style_cb = ((CheckBox)paramAnonymousView.findViewById(2131493011));
            this.style_name.setText(paramAnonymousWebTypeBean.getTypeName());
            return paramAnonymousView;
          }
        });
        this.web_style.setAdapter(this.webstyle);
        this.web_style.setOnScrollListener(new AbsListView.OnScrollListener()
        {
          public void onScroll(AbsListView paramAnonymousAbsListView, int paramAnonymousInt1, int paramAnonymousInt2, int paramAnonymousInt3)
          {
          }

          public void onScrollStateChanged(AbsListView paramAnonymousAbsListView, int paramAnonymousInt)
          {
            if ((paramAnonymousInt == 0) && (paramAnonymousAbsListView.getLastVisiblePosition() == -1 + paramAnonymousAbsListView.getCount()) && (!PCWebLimitManager.this.web_style.getIsNoMore()) && (PCWebLimitManager.this.blDataTask))
            {
              PCWebLimitManager.this.web_style.prepareForRefreshMore();
              PCWebLimitManager.this.isFoot = false;
              PCWebLimitManager.this.loadingData(false);
            }
          }
        });
        this.web_style.setOnLoadMoreListener(new PageListView.OnRefreshListener()
        {
          public void onRefresh()
          {
            PCWebLimitManager.this.web_style.prepareForRefreshMore();
            PCWebLimitManager.this.isFoot = false;
            PCWebLimitManager.this.loadingData(true);
          }
        });
        addOperation(new DataTask().execute(new String[] { "webstyle" }));
        return;
      }
    }
    while (!this.isKey);
    this.web_keyword.setVisibility(0);
  }

  private void initView()
  {
    this.newlist = new ArrayList();
    this.webLimit = ((RadioButton)findViewById(2131493340));
    this.webStyle = ((RadioButton)findViewById(2131493341));
    this.webKeyword = ((RadioButton)findViewById(2131493342));
    this.web_limit = ((PageListView)findViewById(2131493343));
    this.web_style = ((PageListView)findViewById(2131493344));
    this.web_keyword = ((PageListView)findViewById(2131493345));
    this.no_info = ((RelativeLayout)findViewById(2131493337));
    this.add_web_limit = ((TextView)findViewById(2131493346));
    this.delete = ((TextView)findViewById(2131493339));
    this.rl = ((RelativeLayout)findViewById(2131493019));
    this.webLimit.setChecked(true);
    this.web_style.setVisibility(8);
    this.web_limit.setVisibility(8);
    this.web_keyword.setVisibility(8);
    this.no_info.setVisibility(8);
    this.text_alert = ((TextView)findViewById(2131493022));
    this.delete.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        if (PCWebLimitManager.this.isLimit)
          if (PCWebLimitManager.this.newlist.size() > 0)
          {
            System.out.println("PCWebLimitManager" + PCWebLimitManager.this.newlist.size());
            str = "将删除当前所选的 " + PCWebLimitManager.this.newlist.size() + " 项记录";
            PCWebLimitManager.this.DeleteRecordDialog(PCWebLimitManager.this, str);
          }
        while (!PCWebLimitManager.this.isKey)
        {
          String str;
          return;
          PCWebLimitManager.this.alertMessage(PCWebLimitManager.this.getString(2131428118));
          return;
        }
        if (PCWebLimitManager.this.newlist.size() > 0)
        {
          new PCWebLimitManager.DataTask(PCWebLimitManager.this).execute(new String[] { "delkey" });
          return;
        }
        PCWebLimitManager.this.alertMessage(PCWebLimitManager.this.getString(2131428118));
      }
    });
    this.add_web_limit.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        if (PCWebLimitManager.this.isLimit)
          PCWebLimitManager.this.AddWebSiteDialog(PCWebLimitManager.this);
        if (PCWebLimitManager.this.isKey)
          PCWebLimitManager.this.AddKeyWordDialog(PCWebLimitManager.this);
      }
    });
    this.webLimit.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        PCWebLimitManager.this.flag = 0;
        PCWebLimitManager.this.isFoot = false;
        PCWebLimitManager.this.blDataTask = true;
        PCWebLimitManager.this.isLimit = true;
        PCWebLimitManager.this.isStyle = false;
        PCWebLimitManager.this.isKey = false;
        PCWebLimitManager.this.delete.setText(PCWebLimitManager.this.getString(2131427535));
        PCWebLimitManager.this.button.setVisibility(0);
        PCWebLimitManager.this.button.setText(PCWebLimitManager.this.getResources().getString(2131427535));
        PCWebLimitManager.this.add_web_limit.setText(PCWebLimitManager.this.getResources().getString(2131428130));
        PCWebLimitManager.this.web_style.setVisibility(8);
        PCWebLimitManager.this.web_limit.setVisibility(8);
        PCWebLimitManager.this.web_keyword.setVisibility(8);
        PCWebLimitManager.this.no_info.setVisibility(8);
        if ((!PCWebLimitManager.this.isLimitClick) && (PCWebLimitManager.this.page.getEntries().size() == 0))
        {
          PCWebLimitManager.this.no_info.setVisibility(0);
          PCWebLimitManager.this.isLimitClick = true;
        }
        do
        {
          return;
          if ((!PCWebLimitManager.this.isLimitClick) && (PCWebLimitManager.this.page.getEntries().size() != 0))
          {
            PCWebLimitManager.this.web_limit.setVisibility(0);
            PCWebLimitManager.this.isLimitClick = true;
            return;
          }
          if ((PCWebLimitManager.this.isLimitClick) && (PCWebLimitManager.this.page.getEntries().size() == 0))
          {
            PCWebLimitManager.this.no_info.setVisibility(0);
            return;
          }
        }
        while ((!PCWebLimitManager.this.isLimitClick) || (PCWebLimitManager.this.page.getEntries().size() == 0));
        PCWebLimitManager.this.web_limit.setVisibility(0);
      }
    });
    this.webStyle.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        PCWebLimitManager.this.isFoot = false;
        PCWebLimitManager.this.blDataTask = true;
        PCWebLimitManager.this.SetWebEvent(0);
        PCWebLimitManager.this.newlist.clear();
        PCWebLimitManager.this.isLimit = false;
        PCWebLimitManager.this.isStyle = true;
        PCWebLimitManager.this.isKey = false;
        PCWebLimitManager.this.button.setVisibility(8);
        PCWebLimitManager.this.delete.setVisibility(8);
        PCWebLimitManager.this.add_web_limit.setVisibility(0);
        PCWebLimitManager.this.add_web_limit.setText(PCWebLimitManager.this.getResources().getString(2131427479));
        PCWebLimitManager.this.rl.setBackgroundColor(PCWebLimitManager.this.getResources().getColor(2131230728));
        PCWebLimitManager.this.web_style.setVisibility(8);
        PCWebLimitManager.this.web_limit.setVisibility(8);
        PCWebLimitManager.this.web_keyword.setVisibility(8);
        PCWebLimitManager.this.no_info.setVisibility(8);
        if (!PCWebLimitManager.this.isStyleClick)
        {
          PCWebLimitManager.this.initAdapter();
          PCWebLimitManager.this.isStyleClick = true;
        }
        while (!PCWebLimitManager.this.isStyleClick)
          return;
        PCWebLimitManager.this.web_style.setVisibility(0);
      }
    });
    this.webKeyword.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        PCWebLimitManager.this.flag = 0;
        PCWebLimitManager.this.isFoot = false;
        PCWebLimitManager.this.blDataTask = true;
        PCWebLimitManager.this.isLimit = false;
        PCWebLimitManager.this.isStyle = false;
        PCWebLimitManager.this.isKey = true;
        PCWebLimitManager.this.button.setText(PCWebLimitManager.this.getResources().getString(2131427535));
        PCWebLimitManager.this.button.setVisibility(0);
        PCWebLimitManager.this.delete.setVisibility(8);
        PCWebLimitManager.this.add_web_limit.setVisibility(0);
        PCWebLimitManager.this.add_web_limit.setText(PCWebLimitManager.this.getResources().getString(2131428141));
        PCWebLimitManager.this.rl.setBackgroundColor(PCWebLimitManager.this.getResources().getColor(2131230728));
        PCWebLimitManager.this.web_style.setVisibility(8);
        PCWebLimitManager.this.web_limit.setVisibility(8);
        PCWebLimitManager.this.web_keyword.setVisibility(8);
        PCWebLimitManager.this.no_info.setVisibility(8);
        if (!PCWebLimitManager.this.isKeyClick)
        {
          PCWebLimitManager.this.initAdapter();
          PCWebLimitManager.this.isKeyClick = true;
        }
        while (!PCWebLimitManager.this.isKeyClick)
          return;
        PCWebLimitManager.this.web_keyword.setVisibility(0);
      }
    });
  }

  private void loadingData(boolean paramBoolean)
  {
    if (this.isLimit)
    {
      if (paramBoolean)
        this.page.firstPage();
      while (true)
      {
        addOperation(new DataTask().execute(new String[] { "weblimit" }));
        return;
        this.page.nextPage();
      }
    }
    if (paramBoolean)
      this.style_page.firstPage();
    while (true)
    {
      addOperation(new DataTask().execute(new String[] { "webstyle" }));
      return;
      this.style_page.nextPage();
    }
  }

  private void removeAllWebSite()
  {
    for (int i = 0; ; i++)
    {
      if (i >= this.page.getEntries().size())
        return;
      this.newlist.remove(this.page.getEntries().get(i));
    }
  }

  protected void AddKeyWordDialog(Context paramContext)
  {
    View localView = getLayoutInflater().inflate(2130903044, null);
    final Dialog localDialog = new Dialog(paramContext, 2131361814);
    localDialog.setContentView(localView);
    ((EditText)localView.findViewById(2131492891));
    ((RadioButton)localView.findViewById(2131492896)).setText(Html.fromHtml("以<font color=red >*</font>过滤"));
    TextView localTextView1 = (TextView)localView.findViewById(2131492893);
    TextView localTextView2 = (TextView)localView.findViewById(2131492892);
    localTextView1.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        localDialog.dismiss();
      }
    });
    localTextView2.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        localDialog.dismiss();
      }
    });
    localDialog.show();
  }

  public void AddWebLimit(String paramString)
  {
    if (paramString.equals("0"))
    {
      if (this.no_info.isShown())
        this.no_info.setVisibility(8);
      alertMessage(getString(2131427520));
      this.page.getEntries().clear();
      new DataTask().execute(new String[] { "weblimit" });
      return;
    }
    alertMessage(paramString);
  }

  protected void AddWebSiteDialog(Context paramContext)
  {
    View localView = getLayoutInflater().inflate(2130903229, null);
    final Dialog localDialog = new Dialog(paramContext, 2131361814);
    localDialog.setContentView(localView);
    this.add_url = ((EditText)localView.findViewById(2131493637));
    TextView localTextView1 = (TextView)localView.findViewById(2131493639);
    TextView localTextView2 = (TextView)localView.findViewById(2131493638);
    localTextView1.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        localDialog.dismiss();
      }
    });
    localTextView2.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        String str = PCWebLimitManager.this.add_url.getText().toString();
        if (PCWebLimitManager.this.checkURL(str))
        {
          PCWebLimitManager.this.addURL = str;
          Logger.e("System.out", PCWebLimitManager.this.addURL);
          new PCWebLimitManager.AddDataTask(PCWebLimitManager.this).execute(new String[] { "addlimit" });
          localDialog.dismiss();
        }
      }
    });
    localDialog.show();
  }

  protected void DeleteRecordDialog(Context paramContext, String paramString)
  {
    View localView = getLayoutInflater().inflate(2130903083, null);
    final Dialog localDialog = new Dialog(paramContext, 2131361814);
    localDialog.setContentView(localView);
    ((TextView)localView.findViewById(2131492904)).setText(paramString);
    TextView localTextView1 = (TextView)localView.findViewById(2131493071);
    TextView localTextView2 = (TextView)localView.findViewById(2131493070);
    localTextView1.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        localDialog.dismiss();
        if (PCWebLimitManager.this.flag == 0)
          PCWebLimitManager.this.newlist.clear();
      }
    });
    localTextView2.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        try
        {
          if (localDialog.isShowing())
            localDialog.dismiss();
          if (PCWebLimitManager.this.isLimit)
            new PCWebLimitManager.AddDataTask(PCWebLimitManager.this).execute(new String[] { "dellimit" });
          return;
        }
        catch (Exception localException)
        {
          localException.printStackTrace();
        }
      }
    });
    localDialog.show();
  }

  protected void backKeyCallBack()
  {
    finish();
  }

  public void onBackPressed()
  {
    finish();
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903167);
    initActionBar();
    initView();
    initAdapter();
  }

  protected void showDialog(Context paramContext)
  {
    View localView = getLayoutInflater().inflate(2130903082, null);
    final Dialog localDialog = new Dialog(this, 2131361814);
    localDialog.setContentView(localView);
    this.del_yes = ((TextView)localView.findViewById(2131493068));
    this.del_no = ((TextView)localView.findViewById(2131493069));
    TextView localTextView1 = (TextView)localView.findViewById(2131493066);
    TextView localTextView2 = (TextView)localView.findViewById(2131493067);
    localTextView1.setText(getString(2131427522));
    localTextView2.setText(getString(2131427588));
    this.del_no.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        localDialog.dismiss();
      }
    });
    this.del_yes.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        localDialog.dismiss();
        new PCWebLimitManager.AddDataTask(PCWebLimitManager.this).execute(new String[] { "dellimit" });
      }
    });
    localDialog.show();
  }

  public String urlFilter(String paramString)
  {
    String str = paramString;
    if (paramString.contains("http://"))
      str = paramString.replace("http://", "");
    if (paramString.contains("https://"))
      str = paramString.replace("https://", "");
    if (paramString.contains("ftp://"))
      str = paramString.replace("ftp://", "");
    if (paramString.contains("www."))
      str = paramString.replace("www.", "");
    return str;
  }

  class AddDataTask extends AsyncTask<String, Integer, String>
  {
    private String TAG;
    private StateBean bean;
    private String param;

    AddDataTask()
    {
    }

    protected String doInBackground(String[] paramArrayOfString)
    {
      Logger.e(this.TAG, "过滤前--" + PCWebLimitManager.this.addURL);
      PCWebLimitManager.this.addURL = PCWebLimitManager.this.urlFilter(PCWebLimitManager.this.addURL);
      Logger.e(this.TAG, "过滤后--" + PCWebLimitManager.this.addURL);
      this.param = paramArrayOfString[0];
      new RqSP();
      Log.v(this.TAG, PCWebLimitManager.this.userid);
      Log.v(this.TAG, PCWebLimitManager.this.bid);
      try
      {
        if (this.param.equals("addlimit"))
        {
          this.bean = new WebLimitService().addLimitUrl(PCWebLimitManager.this.userid, PCWebLimitManager.this.userpwd, PCWebLimitManager.this.bid, PCWebLimitManager.this.add_url.getText().toString(), PCWebLimitManager.this);
          if (this.bean != null)
          {
            boolean bool = this.bean.getCode().equals("0");
            if (bool)
              return "0";
            return this.bean.getDesc();
          }
          return PCWebLimitManager.this.getString(2131427771);
        }
        if (this.param.equals("dellimit"))
          this.bean = new SoftLimitService().delCommit(PCWebLimitManager.this.userid, PCWebLimitManager.this.bid, PCWebLimitManager.this.newlist, PCWebLimitManager.this);
        return null;
      }
      catch (IOException localIOException)
      {
        while (true)
          localIOException.printStackTrace();
      }
      catch (XmlPullParserException localXmlPullParserException)
      {
        while (true)
          localXmlPullParserException.printStackTrace();
      }
      catch (TimeOutException localTimeOutException)
      {
        while (true)
          localTimeOutException.printStackTrace();
      }
      catch (NotFoundNetWorkException localNotFoundNetWorkException)
      {
        while (true)
          localNotFoundNetWorkException.printStackTrace();
      }
    }

    protected void onPostExecute(String paramString)
    {
      if (this.param.equals("addlimit"))
        if (this.bean.getDesc().equals("成功"))
          PCWebLimitManager.this.AddWebLimit(paramString);
      while (true)
      {
        super.onPostExecute(paramString);
        return;
        PCWebLimitManager.this.alertMessage(this.bean.getDesc());
        continue;
        if (this.param.equals("dellimit"))
          if (this.bean.getDesc().equals("成功"))
          {
            PCWebLimitManager.this.page.getEntries().removeAll(PCWebLimitManager.this.newlist);
            PCWebLimitManager.this.weblimit.notifyDataSetChanged();
            PCWebLimitManager.this.newlist.clear();
            PCWebLimitManager.this.alertMessage(PCWebLimitManager.this.getResources().getString(2131427527));
          }
          else
          {
            PCWebLimitManager.this.alertMessage(PCWebLimitManager.this.getResources().getString(2131427528));
          }
      }
    }

    protected void onPreExecute()
    {
      super.onPreExecute();
    }
  }

  class DataTask extends AsyncTask<String, Integer, String>
  {
    private String TAG;
    private StateBean bean;
    private String param;

    DataTask()
    {
    }

    protected String doInBackground(String[] paramArrayOfString)
    {
      this.param = paramArrayOfString[0];
      RqSP localRqSP = new RqSP();
      PCWebLimitManager.this.userid = localRqSP.getLgDevAccount(PCWebLimitManager.this);
      PCWebLimitManager.this.bid = localRqSP.getLgDevId(PCWebLimitManager.this);
      PCWebLimitManager.this.userpwd = localRqSP.getLgPwd(PCWebLimitManager.this);
      Log.v(this.TAG, PCWebLimitManager.this.userid);
      Log.v(this.TAG, PCWebLimitManager.this.bid);
      try
      {
        if (this.param.equals("weblimit"))
          PCWebLimitManager.this.events = new WebLimitService().getWebBlackList(PCWebLimitManager.this.userid, PCWebLimitManager.this.bid, PCWebLimitManager.this);
        else if (this.param.equals("webstyle"))
          PCWebLimitManager.this.style_events = new WebLimitService().getWebType(PCWebLimitManager.this.userid, PCWebLimitManager.this.bid, PCWebLimitManager.this.style_page.getPageNo(), PCWebLimitManager.this);
      }
      catch (IOException localIOException)
      {
        localIOException.printStackTrace();
      }
      catch (XmlPullParserException localXmlPullParserException)
      {
        localXmlPullParserException.printStackTrace();
      }
      catch (TimeOutException localTimeOutException)
      {
        localTimeOutException.printStackTrace();
      }
      catch (NotFoundNetWorkException localNotFoundNetWorkException)
      {
        localNotFoundNetWorkException.printStackTrace();
      }
      return null;
    }

    protected void onPostExecute(String paramString)
    {
      if (this.param.equals("weblimit"))
        if ((PCWebLimitManager.this.events != null) && (PCWebLimitManager.this.events.size() > 0))
        {
          PCWebLimitManager.this.page.addAllEntries(PCWebLimitManager.this.events);
          PCWebLimitManager.this.web_limit.setVisibility(0);
          PCWebLimitManager.this.weblimit.notifyDataSetChanged();
          PCWebLimitManager.this.web_limit.hideFotterMoreView();
          PCWebLimitManager.this.web_limit.setIsNoMore(true);
          PCWebLimitManager.this.events.clear();
          PCWebLimitManager.this.blDataTask = true;
          PCWebLimitManager.this.isFoot = true;
        }
      while (!this.param.equals("webstyle"))
        while (true)
        {
          if (PCWebLimitManager.this.isFoot)
          {
            PCWebLimitManager.this.closeProgress();
            PCWebLimitManager.this.isFoot = false;
          }
          super.onPostExecute(paramString);
          return;
          if (PCWebLimitManager.this.page.getEntries().size() == 0)
          {
            PCWebLimitManager.this.no_info.setVisibility(0);
          }
          else
          {
            PCWebLimitManager.this.web_limit.hideFotterMoreView();
            PCWebLimitManager.this.web_limit.setIsNoMore(true);
          }
        }
      if ((PCWebLimitManager.this.style_events != null) && (PCWebLimitManager.this.style_events.size() > 0))
      {
        PCWebLimitManager.this.style_page.addAllEntries(PCWebLimitManager.this.style_events);
        PCWebLimitManager.this.web_style.setVisibility(0);
        PCWebLimitManager.this.webstyle.notifyDataSetChanged();
        PCWebLimitManager.this.web_style.onLoadMoreComplete();
        if (PCWebLimitManager.this.style_events.size() < 10)
        {
          PCWebLimitManager.this.web_style.hideFotterMoreView();
          PCWebLimitManager.this.web_style.setIsNoMore(true);
        }
        PCWebLimitManager.this.style_events.clear();
      }
      while (true)
      {
        PCWebLimitManager.this.blDataTask = true;
        PCWebLimitManager.this.isFoot = true;
        break;
        if (PCWebLimitManager.this.style_page.getEntries().size() == 0)
        {
          PCWebLimitManager.this.no_info.setVisibility(0);
        }
        else
        {
          PCWebLimitManager.this.web_limit.hideFotterMoreView();
          PCWebLimitManager.this.web_limit.setIsNoMore(true);
        }
      }
    }

    protected void onPreExecute()
    {
      PCWebLimitManager.this.blDataTask = false;
      if (!PCWebLimitManager.this.isFoot)
        PCWebLimitManager.this.showProgress("");
      super.onPreExecute();
    }
  }
}

/* Location:           C:\Documents and Settings\Administrator\classes_dex2jar.jar
 * Qualified Name:     com.appwoo.txtws.activity.PCWebLimitManager
 * JD-Core Version:    0.6.2
 */